//
//  StrategyForeignJourneyTableViewCell.m
//  ITrip
//
//  Created by dllo on 15/5/28.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "StrategyForeignJourneyTableViewCell.h"

@implementation StrategyForeignJourneyTableViewCell

- (void)dealloc
{
    [self.ForeignJourney_descriptionLabel release];
    [self.ForeignJourney_nameLabel release];
    [self.ForeignJourney_plan_days_countLabel release];
    [self.ForeignJourney_plan_nodes_countLabel release];
    [self.ForeignJourneyImageView release];
    [super dealloc];
}

- (void)setForeignJourneyModel:(StrategyForeignJourneyModel *)foreignJourneyModel
{
    _ForeignJourney_descriptionLabel.text = foreignJourneyModel.ForeignJourney_description;
    _ForeignJourney_nameLabel.text = foreignJourneyModel.ForeignJourney_name;
    _ForeignJourney_plan_days_countLabel.text = [NSString stringWithFormat:@"%ld天/", foreignJourneyModel.ForeignJourney_plan_days_count];
    _ForeignJourney_plan_nodes_countLabel.text = [NSString stringWithFormat:@"%ld个旅行地", foreignJourneyModel.ForeignJourney_plan_nodes_count];
    [_ForeignJourneyImageView setImageWithURL:[NSURL URLWithString:foreignJourneyModel.ForeignJourney_image_url] placeholderImage:[UIImage imageNamed:@"defaultPicture"]];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createMyView];
    }
    return self;
}

- (void)createMyView
{
    self.ForeignJourney_descriptionLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.ForeignJourney_descriptionLabel];
    
    self.ForeignJourneyImageView = [[UIImageView alloc]init];
    [self.contentView addSubview:self.ForeignJourneyImageView];
    
    self.ForeignJourney_nameLabel = [[UILabel alloc]init];
    [self.ForeignJourneyImageView addSubview:self.ForeignJourney_nameLabel];
    
    self.ForeignJourney_plan_days_countLabel = [[UILabel alloc]init];
    [self.ForeignJourneyImageView addSubview:self.ForeignJourney_plan_days_countLabel];
    
    self.ForeignJourney_plan_nodes_countLabel = [[UILabel alloc]init];
    [self.ForeignJourneyImageView addSubview:self.ForeignJourney_plan_nodes_countLabel];
    
    [self.ForeignJourney_descriptionLabel release];
    [self.ForeignJourney_nameLabel release];
    [self.ForeignJourney_plan_days_countLabel release];
    [self.ForeignJourney_plan_nodes_countLabel release];
    [self.ForeignJourneyImageView release];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.ForeignJourneyImageView.frame = CGRectMake(0, 0, self.frame.size.width, 200);
    self.ForeignJourneyImageView.backgroundColor = [UIColor colorWithRed:227/255.0 green:233/255.0 blue:240/255.0 alpha:1];
    
    self.ForeignJourney_nameLabel.frame = CGRectMake(10, 160, 300, 20);
    self.ForeignJourney_nameLabel.backgroundColor = [UIColor clearColor];
    self.ForeignJourney_nameLabel.textColor = [UIColor whiteColor];
    self.ForeignJourney_nameLabel.font = [UIFont boldSystemFontOfSize:17];
    
    self.ForeignJourney_plan_days_countLabel.frame = CGRectMake(10, 180, 50, 20);
    self.ForeignJourney_plan_days_countLabel.backgroundColor = [UIColor clearColor];
    self.ForeignJourney_plan_days_countLabel.textColor = [UIColor whiteColor];
    self.ForeignJourney_plan_days_countLabel.font = [UIFont boldSystemFontOfSize:17];
    
    self.ForeignJourney_plan_nodes_countLabel.frame = CGRectMake(50, 180, 150, 20);
    self.ForeignJourney_plan_nodes_countLabel.backgroundColor = [UIColor clearColor];
    self.ForeignJourney_plan_nodes_countLabel.textColor = [UIColor whiteColor];
    self.ForeignJourney_plan_nodes_countLabel.font = [UIFont boldSystemFontOfSize:17];
    
    self.ForeignJourney_descriptionLabel.frame = CGRectMake(0, 200, self.frame.size.width, 80);
    self.ForeignJourney_descriptionLabel.backgroundColor = [UIColor whiteColor];
    self.ForeignJourney_descriptionLabel.numberOfLines = 3;
    self.ForeignJourney_descriptionLabel.font = [UIFont systemFontOfSize:15];
    [self.ForeignJourney_descriptionLabel sizeToFit];
    self.ForeignJourney_descriptionLabel.textColor = [UIColor blackColor];
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
